package se.energimyndigheten.lampguiden;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.actionbarsherlock.app.SherlockActivity;

import se.energimyndigheten.lampguiden.R;
import se.energimyndigheten.lampguiden.bulbreplacement.SocketActivity;
import se.energimyndigheten.lampguiden.conversiontable.ConversionActivity;
import se.energimyndigheten.lampguiden.info.InfoListActivity;
import se.energimyndigheten.lampguiden.lighting.LightingActivity;

public class DashboardActivity extends SherlockActivity {

    public static final String HTML_BASEPATH = "file:///android_asset/submodule_html/";
    public static final String EXTRA_ACTIVITY = "activity";

    public final static int ACTIVITY_SOCKET = 0;
    public final static int ACTIVITY_LIGHTING = 1;
    public final static int ACTIVITY_CONVERSION = 2;
    public final static int ACTIVITY_INFO = 3;
    
    private static final String TAG = DashboardActivity.class.getSimpleName();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.v(TAG, "onCreate");

        getSupportActionBar().setIcon(R.drawable.ic_actionbar);
        setContentView(R.layout.dashboard_activity);
    }

    /** Event handler from XMl-layout files.
     * 
     * @param view */
    public void onDashboardClick(View view) {
        Log.v(TAG, "onDashboardClick");
        final int id = view.getId();
        Intent intent = null;

        switch (id) {
        case R.id.db_socket:
            Log.v(TAG, " - socket");
            intent = new Intent(this, SocketActivity.class);
            break;
        case R.id.db_lighting:
            Log.v(TAG, " - lighting");
            intent = new Intent(this, LightingActivity.class);
            break;
        case R.id.db_conversion:
            Log.v(TAG, " - conversion");
            intent = new Intent(this, ConversionActivity.class);
            break;
        case R.id.db_info:
            Log.v(TAG, " - info");
            intent = new Intent(this, InfoListActivity.class);
            break;
        }
        if (intent != null) {
            startActivity(intent);
        }
    }
}